11. Microservice Registration

JAVA C2 L4 05 Microservice Creation Registration

For a @SpringBootApplication to be discovery-aware, all that's needed is the Spring Discovery Client (i.e., spring-cloud-starter-netflix-eureka-client dependency) in the classpath. The next step is to annotate the main Spring application class with the @EnableEurekaClient annotation. @EnableEurekaClient is optional if the spring-cloud-starter-netflix-eureka-client dependency is on the classpath.

What happens if a microservice is not registered as a Eureka client?

SOLUTION:
  • The microservice cannot be discovered
  • Clients of the microservice must use the host name and port to access the service.